﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using webapi.Models;

namespace webapi.Controllers
{
    public class MenusController : ApiController
    {

        Menu[] menus = new Menu[]
     {
            new Menu { Id = "1", Name = "soft", Url = "/#getapps", Img = "assets/images/1.jpg" },
            new Menu { Id = "2", Name = "game", Url = "/#getapps", Img = "assets/images/2.jpg" },
            new Menu { Id = "3", Name = "video", Url = "/#getapps", Img = "assets/images/3.jpg" }
     };

        public IEnumerable<Menu> GetAllApps()
        {
            return menus;
        }

        public IHttpActionResult GetMenu(string id)
        {
            var menu = menus.FirstOrDefault((p) => p.Id == id);
            if (menu == null)
            {
                return NotFound();
            }
            return Ok(menu);
        }

    }
}
